package file;

import java.io.File;

public class FileDemo {
    public static void main(String[] args) {
        //绝对路径 不利于跨平台
//        File file=new File("D:\\IDEA\\workplace\\jsd2302\\demo.txt");
        //相对路径 有利于跨平台
        File file = new File("./demo.txt");
        String name = file.getName();
        System.out.println("name=" + name);

        long len = file.length();
        System.out.println(len);

        boolean ih = file.isHidden();//是否隐藏
        boolean cr = file.canRead();//是否可读
        boolean cw = file.canWrite();//是否可写
        System.out.println("是否隐藏:" + ih);
        System.out.println("是否可读:" + cr);
        System.out.println("是否可写:" + cw);
    }
}
